package hr.infomare.drrh.pojo;

// Generated 21.09.2011. 15:44:13 by Hibernate Tools 3.2.1.GA

import hr.infomare.drrh.pomocni.PomocnaDatum;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.StringUtils;

import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.BudgetCommitmentStatusNotification;
import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.InvoiceStatusNotification;
import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.MessageHeader;
import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.NotificationHeader;

/**
 * Notifhead generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "NOTIFHEAD")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Notifhead implements java.io.Serializable {

	private int notheadid;

	private Resmsg resmsg;
	private int statnotid;
	private String notbuduser;
	private String notlosysna;
	private String fmisgwnid;
	private String orsapdocid;
	private String orbufmisid;
	private String notifdate;
	private String descript;
	private Date submdati;

	public Notifhead() {
	}

	@Id
	@Column(name = "NOTHEADID", unique = true, nullable = false, precision = 9, scale = 0)
	public int getNotheadid() {
		return this.notheadid;
	}

	public void setNotheadid(int notheadid) {
		this.notheadid = notheadid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RESMSGID", nullable = false)
	public Resmsg getResmsg() {
		return this.resmsg;
	}

	public void setResmsg(Resmsg resmsg) {
		this.resmsg = resmsg;
	}

	@Column(name = "STATNOTID", nullable = false, precision = 9, scale = 0)
	public int getStatnotid() {
		return this.statnotid;
	}

	public void setStatnotid(int statnotid) {
		this.statnotid = statnotid;
	}

	@Column(name = "NOTBUDUSER", nullable = false, length = 50)
	public String getNotbuduser() {
		return this.notbuduser;
	}

	public void setNotbuduser(String notbuduser) {
		this.notbuduser = notbuduser;
	}

	@Column(name = "NOTLOSYSNA", nullable = false, length = 50)
	public String getNotlosysna() {
		return this.notlosysna;
	}

	public void setNotlosysna(String notlosysna) {
		this.notlosysna = notlosysna;
	}

	@Column(name = "FMISGWNID", nullable = true, length = 50)
	public String getFmisgwnid() {
		return this.fmisgwnid;
	}

	public void setFmisgwnid(String fmisgwnid) {
		this.fmisgwnid = fmisgwnid;
	}

	@Column(name = "ORBUFMISID", length = 50)
	public String getOrbufmisid() {
		return this.orbufmisid;
	}

	public void setOrbufmisid(String orbufmisid) {
		this.orbufmisid = orbufmisid;
	}

	@Column(name = "ORSAPDOCID", nullable = false, length = 50)
	public String getOrsapdocid() {
		return this.orsapdocid;
	}

	public void setOrsapdocid(String orsapdocid) {
		this.orsapdocid = orsapdocid;
	}

	@Column(name = "NOTIFDATE", nullable = true, length = 50)
	public String getNotifdate() {
		return this.notifdate;
	}

	public void setNotifdate(String notifdate) {
		this.notifdate = notifdate;
	}

	@Column(name = "DESCRIPT", length = 120)
	public String getDescript() {
		return this.descript;
	}

	public void setDescript(String descript) {
		this.descript = descript;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "SUBMDATI", nullable = false, length = 10)
	public Date getSubmdati() {
		return this.submdati;
	}

	public void setSubmdati(Date submdati) {
		this.submdati = submdati;
	}

	public void postaviVrijednosti(Integer notHeadId, Integer statNotId,
			Resmsg resMsg, MessageHeader messageHeader,
			NotificationHeader notificationHeader,
			BudgetCommitmentStatusNotification notificationResponse) {
		notheadid = statNotId;
		resmsg = resMsg;
		statnotid = statNotId;
		notbuduser = StringUtils.trimToEmpty(notificationHeader
				.getNotifiedBudgetUser());
		notlosysna = StringUtils
				.trimToEmpty(StringUtils.trimToEmpty(notificationHeader
						.getNotifiedLogicalSystemName()));
		fmisgwnid = StringUtils.trimToEmpty(notificationHeader
				.getFmisGwNotificationId());
		orsapdocid = StringUtils.trimToEmpty(notificationHeader
				.getSapDocumentId());
		orbufmisid = StringUtils.trimToEmpty(notificationHeader
				.getOriginatingBuFmisDocumentID());
		notifdate = StringUtils.trimToEmpty(notificationHeader
				.getNotificationDate());
		descript = StringUtils.trimToEmpty(notificationResponse.getDescription());
		submdati = PomocnaDatum.XMLDatumUDate(messageHeader
				.getSubmitionTimestamp());
	}

	public void postaviVrijednosti(Integer notHeadId, Integer statNotId,
			Resmsg resMsg, MessageHeader messageHeader,
			NotificationHeader notificationHeader,
			InvoiceStatusNotification notificationResponse) {
		notheadid = statNotId;
		resmsg = resMsg;
		statnotid = statNotId;
		notbuduser = StringUtils.trimToEmpty(notificationHeader
				.getNotifiedBudgetUser());
		notlosysna = StringUtils.trimToEmpty(notificationHeader
				.getNotifiedLogicalSystemName());
		fmisgwnid = StringUtils.trimToEmpty(notificationHeader
				.getFmisGwNotificationId());
		orsapdocid = StringUtils.trimToEmpty(notificationHeader
				.getSapDocumentId());
		orbufmisid = StringUtils.trimToEmpty(notificationHeader
				.getOriginatingBuFmisDocumentID());
		notifdate = StringUtils.trimToEmpty(notificationHeader.getNotificationDate());
		descript = StringUtils.trimToEmpty(notificationResponse.getDescription());
		submdati = PomocnaDatum.XMLDatumUDate(messageHeader
				.getSubmitionTimestamp());
	}
}
